package java3_28;

import java.util.*;

/**
 * 3：在Set中放入若干随机的整数，比如10个，然后删除其中的偶数。最后输出这个Set
 */
public class SetDigital {
    public static void main(String[] args) {
        Set<Integer> digital = new HashSet<>();
        EvenNumber en = new EvenNumber();
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < 5; i++) {
            System.out.println("请输入一个整数");
            int x = scanner.nextInt();
            digital.add(x);
        }
        //boolean remove = digital.remove(2);

        Iterator<Integer> it = digital.iterator();
        while (it.hasNext()){
            int x =  it.next();
            if (x%2==0){
                System.out.println("remove:"+x);
                it.remove();
            }
        }
        System.out.println(digital);
    }

}
